package Test;

class Animal{
    String name;
    String color;
    int age;

    public Animal(String name, String color, int age) {
        this.name = name;
        this.color = color;
        this.age = age;
    }

    public void eat(){
        System.out.println(this.name+"正在吃东西！");
    }
}

class Dog extends Animal{
    public Dog() {
        super("花花","黄色",10);
    }

    public void barks(){
        System.out.println(this.name+"汪汪叫!");
    }
    @Override
    public void eat(){
        System.out.println(this.name+"吃狗粮!");
    }
}

class Cat extends Animal{
    public Cat(String name, String color, int age) {
        //帮助初始化子类从父类继承下来的成员
        super(name, color, age);
    }

    public void mew(){
        System.out.println(this.name+"喵喵叫!");
    }
}

public class Test08 {
    public static void main(String[] args) {
        Dog dog = new Dog();
        dog.eat();
        dog.barks();
        System.out.println("=========");
        Cat cat = new Cat("圆圆","橘色",15);
        cat.eat();
        cat.mew();
        Animal animal = new Dog();
        animal.eat();
    }
}
